package com.zang.im.croom.config;

import com.zang.im.croom.config.freemarker.IndexTag;
import freemarker.template.TemplateModelException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * @author Zhang Qiang
 * @Date 2019/7/29 10:24
 */
@Configuration
@ComponentScan
public class FreemarkerConfig {

    @Autowired
    private freemarker.template.Configuration configuration;

    @Autowired
    private IndexTag indexTag;

    @PostConstruct
    public void setConfiguration() throws TemplateModelException {
        configuration.setDefaultEncoding("UTF-8");
        configuration.setSharedVariable("indexTag", indexTag);
    }


}
